package yaml;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.yaml.snakeyaml.Yaml;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @author hanchao
 * @date 2017/5/31 16:25
 */
public class YamlTest {
    public static void main(String[] args) throws FileNotFoundException, JsonProcessingException {
        Yaml yaml = new Yaml();
        File f= new File("f:/1.yml");
        Object result= yaml.load(new FileInputStream(f));
        System.out.println(result);
        System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}
